namespace FutureApp.Migrations
{
    using System;
    using System.Collections.Generic;
    using System.Data.Entity.Infrastructure.Annotations;
    using System.Data.Entity.Migrations;
    
    public partial class _20161206 : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.FutureOrderHeader", "CreatorUserId", "dbo.FutureUsers");
            DropForeignKey("dbo.Customer", "CreatorUserId", "dbo.FutureUsers");
            DropForeignKey("dbo.Customer", "DeleterUserId", "dbo.FutureUsers");
            DropForeignKey("dbo.Customer", "LastModifierUserId", "dbo.FutureUsers");
            DropForeignKey("dbo.FutureOrderHeader", "CustomerId", "dbo.Customer");
            DropForeignKey("dbo.FutureOrderHeader", "DeleterUserId", "dbo.FutureUsers");
            DropForeignKey("dbo.FutureOrderHeader", "LastModifierUserId", "dbo.FutureUsers");
            DropForeignKey("dbo.FutureOrderLine", "CreatorUserId", "dbo.FutureUsers");
            DropForeignKey("dbo.FutureOrderLine", "DeleterUserId", "dbo.FutureUsers");
            DropForeignKey("dbo.FutureOrderLine", "Heard_id", "dbo.FutureOrderHeader");
            DropForeignKey("dbo.FutureOrderLine", "LastModifierUserId", "dbo.FutureUsers");
            DropIndex("dbo.FutureOrderHeader", new[] { "CustomerId" });
            DropIndex("dbo.FutureOrderHeader", new[] { "DeleterUserId" });
            DropIndex("dbo.FutureOrderHeader", new[] { "LastModifierUserId" });
            DropIndex("dbo.FutureOrderHeader", new[] { "CreatorUserId" });
            DropIndex("dbo.Customer", new[] { "DeleterUserId" });
            DropIndex("dbo.Customer", new[] { "LastModifierUserId" });
            DropIndex("dbo.Customer", new[] { "CreatorUserId" });
            DropIndex("dbo.FutureOrderLine", new[] { "Heard_id" });
            DropIndex("dbo.FutureOrderLine", new[] { "DeleterUserId" });
            DropIndex("dbo.FutureOrderLine", new[] { "LastModifierUserId" });
            DropIndex("dbo.FutureOrderLine", new[] { "CreatorUserId" });
            DropTable("dbo.FutureOrderHeader",
                removedAnnotations: new Dictionary<string, object>
                {
                    { "DynamicFilter_OrderHeader_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
                });
            DropTable("dbo.Customer",
                removedAnnotations: new Dictionary<string, object>
                {
                    { "DynamicFilter_Customer_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
                });
            DropTable("dbo.FutureOrderLine",
                removedAnnotations: new Dictionary<string, object>
                {
                    { "DynamicFilter_OrderLine_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
                });
        }
        
        public override void Down()
        {
            CreateTable(
                "dbo.FutureOrderLine",
                c => new
                    {
                        Id = c.Guid(nullable: false),
                        Name = c.String(nullable: false, maxLength: 30),
                        IsActive = c.Boolean(nullable: false),
                        Heard_id = c.Guid(nullable: false),
                        IsDeleted = c.Boolean(nullable: false),
                        DeleterUserId = c.Long(),
                        DeletionTime = c.DateTime(),
                        LastModificationTime = c.DateTime(),
                        LastModifierUserId = c.Long(),
                        CreationTime = c.DateTime(nullable: false),
                        CreatorUserId = c.Long(),
                    },
                annotations: new Dictionary<string, object>
                {
                    { "DynamicFilter_OrderLine_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
                })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.Customer",
                c => new
                    {
                        Id = c.Guid(nullable: false),
                        Name = c.String(nullable: false, maxLength: 30),
                        IsActive = c.Boolean(nullable: false),
                        IsDeleted = c.Boolean(nullable: false),
                        DeleterUserId = c.Long(),
                        DeletionTime = c.DateTime(),
                        LastModificationTime = c.DateTime(),
                        LastModifierUserId = c.Long(),
                        CreationTime = c.DateTime(nullable: false),
                        CreatorUserId = c.Long(),
                    },
                annotations: new Dictionary<string, object>
                {
                    { "DynamicFilter_Customer_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
                })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.FutureOrderHeader",
                c => new
                    {
                        Id = c.Guid(nullable: false),
                        Name = c.String(nullable: false, maxLength: 30),
                        IsActive = c.Boolean(nullable: false),
                        CustomerId = c.Guid(),
                        IsDeleted = c.Boolean(nullable: false),
                        DeleterUserId = c.Long(),
                        DeletionTime = c.DateTime(),
                        LastModificationTime = c.DateTime(),
                        LastModifierUserId = c.Long(),
                        CreationTime = c.DateTime(nullable: false),
                        CreatorUserId = c.Long(),
                    },
                annotations: new Dictionary<string, object>
                {
                    { "DynamicFilter_OrderHeader_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
                })
                .PrimaryKey(t => t.Id);
            
            CreateIndex("dbo.FutureOrderLine", "CreatorUserId");
            CreateIndex("dbo.FutureOrderLine", "LastModifierUserId");
            CreateIndex("dbo.FutureOrderLine", "DeleterUserId");
            CreateIndex("dbo.FutureOrderLine", "Heard_id");
            CreateIndex("dbo.Customer", "CreatorUserId");
            CreateIndex("dbo.Customer", "LastModifierUserId");
            CreateIndex("dbo.Customer", "DeleterUserId");
            CreateIndex("dbo.FutureOrderHeader", "CreatorUserId");
            CreateIndex("dbo.FutureOrderHeader", "LastModifierUserId");
            CreateIndex("dbo.FutureOrderHeader", "DeleterUserId");
            CreateIndex("dbo.FutureOrderHeader", "CustomerId");
            AddForeignKey("dbo.FutureOrderLine", "LastModifierUserId", "dbo.FutureUsers", "Id");
            AddForeignKey("dbo.FutureOrderLine", "Heard_id", "dbo.FutureOrderHeader", "Id");
            AddForeignKey("dbo.FutureOrderLine", "DeleterUserId", "dbo.FutureUsers", "Id");
            AddForeignKey("dbo.FutureOrderLine", "CreatorUserId", "dbo.FutureUsers", "Id");
            AddForeignKey("dbo.FutureOrderHeader", "LastModifierUserId", "dbo.FutureUsers", "Id");
            AddForeignKey("dbo.FutureOrderHeader", "DeleterUserId", "dbo.FutureUsers", "Id");
            AddForeignKey("dbo.FutureOrderHeader", "CustomerId", "dbo.Customer", "Id");
            AddForeignKey("dbo.Customer", "LastModifierUserId", "dbo.FutureUsers", "Id");
            AddForeignKey("dbo.Customer", "DeleterUserId", "dbo.FutureUsers", "Id");
            AddForeignKey("dbo.Customer", "CreatorUserId", "dbo.FutureUsers", "Id");
            AddForeignKey("dbo.FutureOrderHeader", "CreatorUserId", "dbo.FutureUsers", "Id");
        }
    }
}
